package speed;

public class Bitoperator {
	public static void main(String[] args) {
//		&   %   |    ~    ^   
		System.out.println("按位与：&");
		System.out.println("按位或：|");
		System.out.println("按位异或：^");
		System.out.println("位取反：~");
		System.out.println("-----------------------------------------------------------------------------");
		System.out.println("2,3为正数，源码反码补码一样");
		System.out.println("2:00000000	00000000  00000000	  00000010");
		System.out.println("3:00000000	00000000  00000000	  00000011");
		System.out.print("2&3的答案是：");
		System.out.println(2&3);
		System.out.println("&：两个都为1，才是1，所以是：");
		System.out.println("2:00000000	00000000  00000000	  00000010");
		System.out.println("3:00000000	00000000  00000000	  00000011");
		System.out.println("  00000000	00000000  00000000	  00000010,答案是2");
		System.out.println("-----------------------------------------------------------------------------");
		System.out.print("2|3的答案是：");
		System.out.println(2|3);	
		System.out.println("&：有一个是1，就是1，所以是：");
		System.out.println("2:00000000	00000000  00000000	  00000010");
		System.out.println("3:00000000	00000000  00000000	  00000011");
		System.out.println("  00000000	00000000  00000000	  00000011,答案是3");	
		System.out.println("-----------------------------------------------------------------------------");
		System.out.print("2^3的答案是：");
		System.out.println(2^3);
		System.out.println("^：不一样的就是1");
		System.out.println("2:00000000	00000000  00000000	  00000010");
		System.out.println("3:00000000	00000000  00000000	  00000011");
		System.out.println("  00000000	00000000  00000000	  00000001,答案是1");
		System.out.println(~3);
		
	}

}
